﻿<!--
  Extended Silverlight Toolkit - SAMPLE CODE

  Copyright (C) 2010-2012 Xceed Software Inc.

  This program is provided to you under the terms of the Microsoft Public
  License (Ms-PL) as published at http://extendedsilverlight.codeplex.com/license

  Please purchase a commercial version of this toolkit if you are using
  it in a commercial product. The commercial versions support the project,
  and also include more features for each control, priority support,
  source code, updates, removed watermark, and a proprietary license.

  Visit http://xceed.com and follow @datagrid on Twitter.
-->

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:utils="clr-namespace:Xceed.Utils.Silverlight.ListBox.Samples"
                    xmlns:sllb="http://schemas.xceed.com/silverlight/xaml/listbox">
   <utils:BoxArtImageSourceConverter x:Key="boxArtImageSourceConverter" />

   <utils:TaggedTextToTextConverter x:Key="taggedTextToTextConverter" />

   <utils:RatingConverter x:Key="ratingConverter">
      <utils:RatingConverter.FullTemplate>
         <DataTemplate>
            <Grid Height="17.503"
                  Width="18.058">
               <Path Data="M10.3301,1.75C10.8101,1.75,13.3701,6.6,13.3701,6.6C13.3701,6.6,18.7001,7.58,18.8501,8.04C18.9901,8.51,15.2501,12.48,15.2501,12.48C15.2501,12.48,15.9801,17.939,15.5901,18.23C15.2001,18.51,10.3301,16.12,10.3301,16.12C10.3301,16.12,5.4501,18.51,5.0601,18.23C4.6701,17.939,5.4001,12.48,5.4001,12.48C5.4001,12.48,1.6601,8.51,1.8001,8.04C1.9501,7.58,7.2801,6.6,7.2801,6.6C7.2801,6.6,9.8401,1.75,10.3301,1.75z"
                     StrokeStartLineCap="Round"
                     Stretch="Fill"
                     StrokeEndLineCap="Round"
                     StrokeLineJoin="Round">
                  <Path.Fill>
                     <RadialGradientBrush Center="0.32475655879383225,0.2948194267000162"
                                          GradientOrigin="0.32475655879383225,0.2948194267000162"
                                          RadiusX="0.6767785021934019"
                                          RadiusY="0.7192158289718202">
                        <GradientStop Color="#FFFF8000"
                                      Offset="1" />
                        <GradientStop Color="#FFF9F2D6" />
                        <GradientStop Color="#FFFFD200"
                                      Offset="0.438" />
                     </RadialGradientBrush>
                  </Path.Fill>
               </Path>
               <Path Data="M10.3301,1.75C10.8101,1.75,13.3701,6.6,13.3701,6.6C13.3701,6.6,18.7001,7.58,18.8501,8.04C18.9901,8.51,15.2501,12.48,15.2501,12.48C15.2501,12.48,15.9801,17.939,15.5901,18.23C15.2001,18.51,10.3301,16.12,10.3301,16.12C10.3301,16.12,5.4501,18.51,5.0601,18.23C4.6701,17.939,5.4001,12.48,5.4001,12.48C5.4001,12.48,1.6601,8.51,1.8001,8.04C1.9501,7.58,7.2801,6.6,7.2801,6.6C7.2801,6.6,9.8401,1.75,10.3301,1.75z"
                     StrokeStartLineCap="Round"
                     Stretch="Fill"
                     StrokeEndLineCap="Round"
                     StrokeThickness="1"
                     StrokeLineJoin="Round"
                     Stroke="#33FFFFFF" />
            </Grid>
         </DataTemplate>
      </utils:RatingConverter.FullTemplate>

      <utils:RatingConverter.HalfTemplate>
         <DataTemplate>
            <Grid Height="17.504"
                  Width="18.058">
               <Path Data="M15.25,12.4805C15.25,12.4805,15.98,17.9395,15.59,18.2305C15.2,18.5095,10.33,16.1205,10.33,16.1205C10.33,16.1205,5.45,18.5095,5.06,18.2305C4.67,17.9395,5.4,12.4805,5.4,12.4805C5.4,12.4805,1.66,8.5095,1.8,8.0405C1.95,7.5805,7.28,6.6005,7.28,6.6005"
                     StrokeStartLineCap="Round"
                     Stretch="Fill"
                     StrokeEndLineCap="Round"
                     StrokeThickness="0"
                     StrokeLineJoin="Round"
                     Margin="0,4.851,3.15,0">
                  <Path.Fill>
                     <RadialGradientBrush Center="0.32475655879383225,0.2948194267000162"
                                          GradientOrigin="0.32475655879383225,0.2948194267000162"
                                          RadiusX="0.6767785021934019"
                                          RadiusY="0.7192158289718202">
                        <GradientStop Color="#FFFF8000"
                                      Offset="1" />
                        <GradientStop Color="#FFF9F2D6" />
                        <GradientStop Color="#FFFFD200"
                                      Offset="0.438" />
                     </RadialGradientBrush>
                  </Path.Fill>
               </Path>
               <Path Data="M10.3301,1.75C10.8101,1.75,13.3701,6.6,13.3701,6.6C13.3701,6.6,18.7001,7.58,18.8501,8.04C18.9901,8.51,15.2501,12.48,15.2501,12.48C15.2501,12.48,15.9801,17.939,15.5901,18.23C15.2001,18.51,10.3301,16.12,10.3301,16.12C10.3301,16.12,5.4501,18.51,5.0601,18.23C4.6701,17.939,5.4001,12.48,5.4001,12.48C5.4001,12.48,1.6601,8.51,1.8001,8.04C1.9501,7.58,7.2801,6.6,7.2801,6.6C7.2801,6.6,9.8401,1.75,10.3301,1.75z"
                     StrokeStartLineCap="Round"
                     Stretch="Fill"
                     StrokeEndLineCap="Round"
                     StrokeThickness="1"
                     StrokeLineJoin="Round"
                     Opacity="0.5"
                     Margin="0,0,0,0.001">
                  <Path.Stroke>
                     <RadialGradientBrush Center="0.32475655879383225,0.2948194267000162"
                                          GradientOrigin="0.32475655879383225,0.2948194267000162"
                                          RadiusX="0.6767785021934019"
                                          RadiusY="0.7192158289718202">
                        <GradientStop Color="#FFFF8000"
                                      Offset="1" />
                        <GradientStop Color="#FFF9F2D6" />
                        <GradientStop Color="#FFFFD200"
                                      Offset="0.438" />
                     </RadialGradientBrush>
                  </Path.Stroke>
               </Path>
            </Grid>
         </DataTemplate>
      </utils:RatingConverter.HalfTemplate>

      <utils:RatingConverter.EmptyTemplate>
         <DataTemplate>
            <Grid Height="17.503"
                  Width="18.058">
               <Path Data="M10.3301,1.75C10.8101,1.75,13.3701,6.6,13.3701,6.6C13.3701,6.6,18.7001,7.58,18.8501,8.04C18.9901,8.51,15.2501,12.48,15.2501,12.48C15.2501,12.48,15.9801,17.939,15.5901,18.23C15.2001,18.51,10.3301,16.12,10.3301,16.12C10.3301,16.12,5.4501,18.51,5.0601,18.23C4.6701,17.939,5.4001,12.48,5.4001,12.48C5.4001,12.48,1.6601,8.51,1.8001,8.04C1.9501,7.58,7.2801,6.6,7.2801,6.6C7.2801,6.6,9.8401,1.75,10.3301,1.75z"
                     StrokeStartLineCap="Round"
                     Stretch="Fill"
                     StrokeEndLineCap="Round"
                     StrokeThickness="1"
                     StrokeLineJoin="Round"
                     Opacity="0.5">
                  <Path.Stroke>
                     <RadialGradientBrush Center="0.32475655879383225,0.2948194267000162"
                                          GradientOrigin="0.32475655879383225,0.2948194267000162"
                                          RadiusX="0.6767785021934019"
                                          RadiusY="0.7192158289718202">
                        <GradientStop Color="#FFFF8000"
                                      Offset="1" />
                        <GradientStop Color="#FFF9F2D6" />
                        <GradientStop Color="#FFFFD200"
                                      Offset="0.438" />
                     </RadialGradientBrush>
                  </Path.Stroke>
               </Path>
            </Grid>
         </DataTemplate>
      </utils:RatingConverter.EmptyTemplate>
   </utils:RatingConverter>

   <Style x:Key="movieTooltipStyle"
          TargetType="ToolTip">
      <Setter Property="Background"
              Value="#FF2B2B2B" />
      <Setter Property="Padding"
              Value="4" />
      <Setter Property="BorderThickness"
              Value="1" />
      <Setter Property="BorderBrush"
              Value="#FF161616" />
      <Setter Property="Template">
         <Setter.Value>
            <ControlTemplate TargetType="ToolTip">
               <Border x:Name="Root"
                       BorderThickness="{TemplateBinding BorderThickness}"
                       BorderBrush="{TemplateBinding BorderBrush}"
                       Background="{TemplateBinding Background}">
                  <Border.Resources>
                     <Storyboard x:Key="Visible State" />
                     <Storyboard x:Key="Normal State" />
                  </Border.Resources>
                  <ContentPresenter Content="{TemplateBinding Content}"
                                    ContentTemplate="{TemplateBinding ContentTemplate}"
                                    Cursor="{TemplateBinding Cursor}"
                                    Margin="{TemplateBinding Padding}" />
               </Border>
            </ControlTemplate>
         </Setter.Value>
      </Setter>
   </Style>

   <DataTemplate x:Key="movieListBoxItemTemplate">
      <Grid Margin="0,0,0,6">
         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="78" />
            <ColumnDefinition Width="0.8*" />
            <ColumnDefinition Width="3" />
            <ColumnDefinition Width="0.2*" />
         </Grid.ColumnDefinitions>
         <Grid.RowDefinitions>
            <RowDefinition Height="28" />
            <RowDefinition Height="26" />
            <RowDefinition Height="26" />
            <RowDefinition Height="26" />
         </Grid.RowDefinitions>

         <Image Source="{Binding Path=BoxArt.LargeUrl, Converter={StaticResource boxArtImageSourceConverter}}"
                Stretch="UniformToFill"
                Grid.RowSpan="4"
                Margin="3,0">
            <ToolTipService.ToolTip>
               <ToolTip Style="{StaticResource movieTooltipStyle}">
                  <Image Source="{Binding Path=BoxArt.LargeUrl, Converter={StaticResource boxArtImageSourceConverter}}" />
               </ToolTip>
            </ToolTipService.ToolTip>
         </Image>

         <TextBlock Grid.Column="1"
                    Text="{Binding Path=Name}"
                    FontSize="28"
                    TextTrimming="WordEllipsis"
                    Margin="6,-8,0,-4" />

         <TextBlock Grid.Column="1"
                    Grid.Row="1"
                    Grid.RowSpan="3"
                    Text="{Binding Path=Synopsis, Converter={StaticResource taggedTextToTextConverter}}"
                    FontSize="13"
                    TextWrapping="Wrap"
                    TextTrimming="WordEllipsis"
                    Foreground="#FF666666"
                    Margin="6,4,0,0" />

         <Border Grid.Column="2"
                 Margin="1,1,0,0"
                 Grid.Row="1"
                 Grid.RowSpan="3"
                 Background="#FF2B2B2B" />

         <Grid Grid.Column="3"
               Grid.Row="1"
               HorizontalAlignment="Center"
               VerticalAlignment="Center">
            <Grid.ColumnDefinitions>
               <ColumnDefinition Width="Auto" />
               <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <ItemsControl Grid.Column="0"
                          ItemsSource="{Binding Path=AverageRating, Converter={StaticResource ratingConverter}}"
                          VerticalAlignment="Center"
                          HorizontalAlignment="Center"
                          ToolTipService.ToolTip="{Binding StringFormat=\{0:f1\}}">
               <ItemsControl.ItemsPanel>
                  <ItemsPanelTemplate>
                     <StackPanel Orientation="Horizontal" />
                  </ItemsPanelTemplate>
               </ItemsControl.ItemsPanel>
            </ItemsControl>
         </Grid>

         <TextBlock Grid.Row="2"
                    Grid.Column="3"
                    Text="{Binding Path=ReleaseYear}"
                    FontSize="32"
                    Foreground="#FF666666"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center" />

         <StackPanel Grid.Column="3"
                     Grid.Row="3"
                     VerticalAlignment="Center"
                     HorizontalAlignment="Center"
                     Orientation="Horizontal">
            <TextBlock Text="RATED "
                       FontSize="15"
                       Foreground="#FF666666" />

            <TextBlock Foreground="#FF666666"
                       Text="{Binding Path=Rating}"
                       FontSize="15"/>
         </StackPanel>
      </Grid>
   </DataTemplate>

</ResourceDictionary>
